home *** CD-ROM | disk | FTP | other *** search
-
- solution for CrackMe Level 1 By noos@nettaxi.com
- solved By Nuno1 on 22 july 1999
- any comments can be sent to nuno_2@hotmail.com
- ------------------------------------------------
-
- Information :
- Cracker : Nuno1
- Date : 22 july 1999
- Level : 2-3
- Protection : Key for a code.
-
- Tools used :
- - SoftIce
- - Borland C for Combination finder
-
- Hey Crackers !
-
- this is a pretty easy crackme to understand the idea. but you have to understand it.
-
- -- Information --
-
- ok the crackme show us a CODE and wait for us to fill the KEY , when pressing ok it check
- the key if its the right key or not.
-
- ----------------------------- CRACKING THE PROGRAM --------------------------
-
- ok , let start with bpx on hmemcpy to get in when he cut our key.
-
- press some F12 until you will see this :
-
- :00401456 E8F9020000 Call 00401754
- :0040145B 8B442410 mov eax, dword ptr [esp+10] <- here is your key
- :0040145F 8D542418 lea edx, dword ptr [esp+18]
- :00401463 52 push edx
- :00401464 6848304000 push 00403048
- :00401469 50 push eax
- :0040146A FF1584214000 Call dword ptr [00402184] <- scanf (make your key numeric)
- :00401470 8B4C2424 mov ecx, dword ptr [esp+24] <- our number return in ecx
- :00401474 51 push ecx
- :00401475 FF15B0214000 Call dword ptr [004021B0] <-srand function
- :0040147B 8B3DB8214000 mov edi, dword ptr [004021B8]
- :00401481 83C410 add esp, 00000010
- :00401484 BE0C000000 mov esi, 0000000C
- :00401489 FFD7 call edi <- rand function
-
- ok so we in the right place .. as you can see he calls the srand and rand function
- if you dont know srand is a function that start a randomize number .
- what does it mean ? it means that if you want a random number you can call rand function
- but it will allways be the same randomize numbers. srand start the randomize with a asked
- number.. mostly everyone send the time to it , because it allways not the same.
-
- so you can see that srand gets our key and if you will get in , you will see it also
- start the randomize number with the given number.
-
- then there is a call to rand to get a randomize number .. but its really not a randomize
- number for us now .. we can learn the rand function and to know witch number will return
- allways.
-
- i allready done your job and write it in the C program that came with my tutorial.
- so lets continue :
-
- :00401484 BE0C000000 mov esi, 0000000C <- esi = 0xC (12d)
- :00401489 FFD7 call edi <- rand function
-
- :0040148B 99 cdq
- :0040148C B91A000000 mov ecx, 0000001A
- :00401491 F7F9 idiv ecx <-divide the number we got from rand
- <-with 1Ah
- <-so it means that eax = result
- <-and edx = modular
- <-edx will allways be a number between
- <-0 to 1Ah
-
- :00401493 8D4C240C lea ecx, dword ptr [esp+0C]
- :00401497 8A541424 mov dl, byte ptr [esp+edx+24] <-taking somthing from esp+edx+24 ??
- :0040149B 52 push edx <-push the taking byte
- :0040149C E8AD020000 Call 0040174E <-??
- :004014A1 4E dec esi
- :004014A2 75E5 jne 00401489 jmp when esi-1 (12 times)
-
- ok so we can see this is a loop on the rand number . he gets the number divide with 1A
- take the modular and take it from esp+24+modular.
-
- ok , bpx on the line of 401497 and do d esp+24 .. what do u see ??? :) a table :
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- there are 26 letters right ? if we hex it it will be 1A .. so he choose a RANDOM letter
- each time , the "??" call you can see above is a call to add the letter to a new string.
-
- for us is not a random number (it is but .. :) ) because we can get the same result with
- a program that we will write .. but lets continue :
-
- :004014A4 8B442414 mov eax, dword ptr [esp+14] <- the CODE !!
- :004014A8 8B4C240C mov ecx, dword ptr [esp+0C] <- your new KEY !!
- :004014AC 50 push eax
- :004014AD 51 push ecx
- :004014AE FF15BC214000 Call dword ptr [004021BC] <- comapare !!
- :004014B4 83C408 add esp, 00000008
- :004014B7 85C0 test eax, eax
- :004014B9 7512 jne 004014CD <-is is not ok ?
- :004014BB 50 push eax <-if yes stay here
- :004014BC 683C314000 push 0040313C
- :004014C1 682C304000 push 0040302C <- the string "Thank you for registering!"
- :004014C6 8BCD mov ecx, ebp
-
- so we found the algo of this one .. its srand your serial number and start to get rand each
- time for a new char.
- well you may understand that to reverse it is imposible (maybe its not for me).
-
- so we have to write a combination finder for this program.
-
- all we have to do is to srand(number) , take the rand number mod with 1Ah and get the char
- for it until we pass 0c times (there are 12 letters for the code and he also run 0Ch times)
- and check if the code is ok .. if not .. number+1 ;) and so on ..
-
- well , i wrote my example (as allways) in C for you to understand it more . but it
- can be writen in assembler and get much better results. even that it takes only 8 min to find.
-
- even so !! the key to this crackme is : 692659380
-
- you can understand by that .. that the person that right the crackme is also dont have a clue
- whats going on there .. he just call rand and srand to make the job .. for him to get the
- CODE of is own , he just write a program that will do the same as we do , he type a number
- and make the rand , srand make the job and took the CODE for it and hardcoded it in the
- program.
-
- well thats it for this crackme ..
-
- hope you learn somthing new ;)
-
- Nuno1 - Nuno_2@hotmail.com
-
-
-